import random
import unittest
import ConfigParser

import sys
sys.path.append('..')

from lib.DBWrapper import DBWrapper
from db.ContractAdapter import ContractAdapter

class ContractAdapterTest(unittest.TestCase):

    def setUp(self):
        config = ConfigParser.ConfigParser()
        config.read('../cfg/config.cfg')        
        self.db = DBWrapper(config.get('Database', 'testdb'))

    def test_contractselect(self):
        contracts = self.db.getContracts()
        self.assertIsNotNone(contracts)
        self.assertEqual(contracts[0].m_symbol, "N225M")


if __name__ == '__main__':
    unittest.main()